class PutawayDetailResponse {
  final int code;
  final PutawayDetail? data;
  final String msg;

  PutawayDetailResponse({
    required this.code,
    required this.data,
    required this.msg,
  });

  factory PutawayDetailResponse.fromJson(Map<String, dynamic> json) {
    return PutawayDetailResponse(
      code: json['code'] as int,
      data: json['data'] != null ? PutawayDetail.fromJson(json['data']) : null,
      msg: json['msg'] as String,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'code': code,
      'data': data?.toJson(),
      'msg': msg,
    };
  }
}

class PutawayDetail {
  final int id;
  final String itemNumber;
  final Location location;
  final int quantity;
  final ShipmentLine shipmentLine;
  final String status;

  PutawayDetail({
    required this.id,
    required this.quantity,
    required this.itemNumber,
    required this.status,
    required this.location,
    required this.shipmentLine,
  });

  factory PutawayDetail.fromJson(Map<String, dynamic> json) {
    return PutawayDetail(
      id: json['id'] as int,
      itemNumber: json['item_number'] as String,
      location: Location.fromJson(json['location']),
      quantity: json['quantity'] as int,
      shipmentLine: ShipmentLine.fromJson(json['shipment_line']),
      status: json['status'] as String,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'item_number': itemNumber,
      'location': location.toJson(),
      'quantity': quantity,
      'shipment_line': shipmentLine.toJson(),
      'status': status,
    };
  }
}

class Location {
  final int id;
  final String number;

  Location({
    required this.id,
    required this.number,
  });

  factory Location.fromJson(Map<String, dynamic> json) {
    return Location(
      id: json['id'] as int,
      number: json['number'] as String,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'number': number,
    };
  }
}

class ShipmentLine {
  final int id;
  final String lpnNumber;

  ShipmentLine({
    required this.id,
    required this.lpnNumber,
  });

  factory ShipmentLine.fromJson(Map<String, dynamic> json) {
    return ShipmentLine(
      id: json['id'] as int,
      lpnNumber: json['lpn_number'] as String,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'lpn_number': lpnNumber,
    };
  }
}